package com.kinghood.productcenter.common.model.dto.sku;

import lombok.Data;
import org.springframework.util.CollectionUtils;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

/**
 * description
 *
 * @author zhangFanJun
 * @date 2024-01-24 17:49
 **/
@Data
public class GetSkuRelateIdDTO implements Serializable {

    private Long id;
    private List<Long> extrasIdList;
    private List<Long> supplierIdList;

    private List<Long> otherIdList;

    public void handle(){
        ArrayList<Long> list = new ArrayList<>();
        if(!CollectionUtils.isEmpty(extrasIdList)){
            list.addAll(extrasIdList);
        }
        if(!CollectionUtils.isEmpty(supplierIdList)){
            list.addAll(supplierIdList);
        }
        otherIdList = list.stream().filter(Objects::nonNull).collect(Collectors.toList());
    }

}
